home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TGCBOR20.ARJ / INTROPAK.COM / RESIZE.C < prev    next >
Text File  |  1991-04-25  |  2KB  |  75 lines

  1.  
  2.  /* program resize  */
  3.  
  4. #include "teglsys.h"
  5.  
  6.   /* -- this program illustrates how to define a mouse click area, specifically  */
  7.   /* -- a resize click area and how to associate an event that will be called  */
  8.   /* -- by the supervisor whenever the frame is resized.  */
  9.  
  10.  
  11.   /* -- Just draws a frame with a rectangle in the corner which will  */
  12.   /* -- be the resize mouse click area.  */
  13.  
  14.  
  15. void drawwinframe(imagestkptr  ifs);
  16.  
  17. void         frameit(imagestkptr  ifs)
  18.   {
  19.     setfillstyle(SOLID_FILL,WHITE);
  20.     setviewport(0,0,getmaxx(),getmaxy(),FALSE);
  21.     bar(ifs->x,ifs->y,ifs->x1,ifs->y1);
  22.     setcolor(BLACK);
  23.     rectangle(ifs->x,ifs->y,ifs->x1,ifs->y1);
  24.     rectangle(ifs->x1 - 10,ifs->y1 - 10,ifs->x1 - 1,ifs->y1 - 1);
  25.   }
  26.  
  27.  
  28.   /* -- event that is called automatically after a resize mouse click area  */
  29.   /* -- is selected and the frame is resized.  */
  30.  
  31.  
  32. unsigned redrawwinframe(imagestkptr  ifs, msclickptr   ms)
  33.   {
  34.     drawwinframe(ifs);
  35.     return 0;
  36.   }
  37.  
  38.   /* -- Draw the window frame and define the the mouse click area for the  */
  39.   /* -- resizing action  */
  40.  
  41.  
  42. void drawwinframe(imagestkptr  ifs)
  43.   { int     mx, my;
  44.  
  45.     frameit(ifs);
  46.     resetmouseclicks(ifs,NULL);
  47.     mx = ifs->x1 - ifs->x;
  48.     my = ifs->y1 - ifs->y;
  49.  
  50.       /* -- set framesize constraints  */
  51.  
  52.     defineresizeminmax(ifs,100,100,400,200);
  53.       /* -- set the mouse click area  */
  54.     defineresizeclickarea(ifs,mx - 10,my - 10,mx,my,redrawwinframe);
  55.   }
  56.  
  57.  
  58.  
  59.   imagestkptr  window;
  60.  
  61.  
  62. void main(int argc, char **argv)
  63. {
  64.  
  65.   easytegl();    /* -- standard set up  */
  66.   easyout();
  67.   pushimage(100,100,300,200);    /* -- save background  */
  68.   window = stackptr;   /* -- get the pointer  */
  69.   drawwinframe(window);   /* -- draw it the first time    */
  70.   teglsupervisor();   /* -- give it to the supervisor  */
  71. }
  72.  
  73.  
  74.  
  75.